package com.objectproject.main.dao;

import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.objectproject.main.dao.iface.MyGroupDAO;
import com.objectproject.main.dao.mybatis.mapper.MyGroupMapper;
import com.objectproject.main.model.MyGroup;
import com.objectproject.main.service.subsystem.MyLocaleResolver;

@Repository
public class MyGroupDAOImpl implements MyGroupDAO {
	
	private static final Logger logger = LoggerFactory.getLogger(MyObjectDAOImpl.class);
	
	@Autowired
	MyPropertyDAOImpl myPropertyDAOImpl;
	
	@Autowired
	MyLocaleResolver myLocaleResolver;
	
	@Autowired
	SqlSession sqlSession;
	
	@Override
	public MyGroup selectMyGroupById(long groupId) {
		logger.info("Method invocation : selectMyGroupById(" + groupId + ")");
		
		return sqlSession.getMapper(MyGroupMapper.class).selectMyGroupById(groupId);
	}

	@Override
	public MyGroup selectMyGroupDetail(MyGroup myGroup, int localeId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long insertMyGroup(MyGroup myGroup) {
		logger.info("Method invocation : insertMyGroup");
		
		sqlSession.getMapper(MyGroupMapper.class).insertMyGroup(myGroup);
		
		return myGroup.getGroupId();
	}

	@Override
	public void insertMyGroupDetail(MyGroup myGroup, int localeId) {
		logger.info("Method invocation : insertMyGroupDetail");
		
		sqlSession.getMapper(MyGroupMapper.class).insertMyGroupDetail(myGroup, localeId);
	}

	@Override
	public void deleteMyGroup(MyGroup myGroup) {
		logger.info("Method invocation : deleteMyGroup");
		
		sqlSession.getMapper(MyGroupMapper.class).deleteMyGroup(myGroup);
	}

	@Override
	public void deleteMyGroupById(long groupId) {
		logger.info("Method invocation : deleteMyGroupById");
		
		sqlSession.getMapper(MyGroupMapper.class).deleteMyGroupById(groupId);
	}

	@Override
	public void updateMyGroup(MyGroup myGroup) {
		logger.info("Method invocation : updateMyGroup");
		
		sqlSession.getMapper(MyGroupMapper.class).updateMyGroup(myGroup);
	}

	@Override
	public void updateMyGroupDeatil(MyGroup myGroup, int localeId) {
		logger.info("Method invocation : updateMyGroupDeatil");
		
		sqlSession.getMapper(MyGroupMapper.class).updateMyGroupDeatil(myGroup, localeId);
	}

}
